﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;


namespace UtopianGame.graphics.menu
{
    class CommunicationScreen : BaseMenu
    {
        private String message;

        public CommunicationScreen(ContentManager cm, String newMessage)
        {
            init(cm,newMessage);
        }

        protected void init(ContentManager cm, String newMessage)
        {
            base.init(cm);
            spriteName = "blueSquare";
            sprite = cm.Load<Texture2D>(spriteName);
            boundingBox.Width = 750;
            boundingBox.Height = 550;

            message = newMessage;

            int centerAlignmentNumber = 0;
            //Governor Button alignment to top of menu
            centerAlignmentNumber = boundingBox.X + (boundingBox.Width / 2);
            centerAlignmentNumber -= ((int)(GlobalDataHolder.baseFont.MeasureString("Governor").X) / 2);
            //displays button
            addToSubObjectList(new GovernorButton(contentManager), 450, 100, 100);

            //Business Button alignment below governor
            centerAlignmentNumber = boundingBox.X + (boundingBox.Width / 2);
            centerAlignmentNumber -= ((int)(GlobalDataHolder.baseFont.MeasureString("Businesses").X) / 2);
            //displays button
            addToSubObjectList(new BusinessButton(contentManager), 450, 175, 175);

            //Citizens button aligment below businesses
            centerAlignmentNumber = boundingBox.X + (boundingBox.Width / 2);
            centerAlignmentNumber -= ((int)(GlobalDataHolder.baseFont.MeasureString("Citizens").X) / 2);
            //displays button
            addToSubObjectList(new CitizenButton(contentManager), 450, 250, 250);


          //Close menu button at the bottom of the screen
            centerAlignmentNumber = boundingBox.X + (boundingBox.Width / 2);
            centerAlignmentNumber -= ((int)(GlobalDataHolder.baseFont.MeasureString("Close").X) / 2);   

            addToSubObjectList(new CloseMenuButton(contentManager), 450, 500, 500);
            
        }
       
        public override void draw(SpriteBatch sb)
        {
            base.draw(sb);
            //centerAlignmentNumber is used to dynamically center text on top of the menu
            int centerAlignmentNumber = 0;
            centerAlignmentNumber = boundingBox.X + (boundingBox.Width / 2);
            centerAlignmentNumber -= ((int)(GlobalDataHolder.baseFont.MeasureString(message).X) / 2);
            sb.DrawString(GlobalDataHolder.baseFont, message, new Microsoft.Xna.Framework.Vector2(centerAlignmentNumber, boundingBox.Y + 8), Color.Black);
        }

    
    }

}
    

